function genMontage(data, type)
load_settings;

for ix = 1:size(data,1)
    for jx = 1:size(data,2)
        if data(ix,jx).cam_id > 0
            str = [' for camera ' num2str(ix) ' and image ' num2str(jx)];
            switch type
                case 'HOG'
                    figure(1);
                    disp(['Displaying HOGs for camera ' num2str(ix) ' and image ' num2str(jx)]);
                    hogMontage(data(ix,jx).ppl_hogs);
                    set(gcf, 'name', ['People, camera:' num2str(data(ix,jx).cam_id) ', img_index:' num2str(jx)], 'numbertitle', 'off');
                    figure(2);
                    hogMontage(data(ix,jx).ppl_hogs);
                    set(gcf, 'name', ['Non-People, camera:' num2str(data(ix,jx).cam_id) ', img_index:' num2str(jx)], 'numbertitle', 'off');
                    wait();
                    
                case 'PATCH'
                    figure(1);
                    disp(['Displaying patches for camera ' num2str(ix) ' and image ' num2str(jx)]);
                    patchMontage([image_root, sprintf('%08d',data(ix,jx).cam_id), '/', data(ix,jx).filename],...
                        data(ix,jx).ppl_rects);
                    set(gcf, 'name', ['People, camera:' num2str(data(ix,jx).cam_id) ', img_index:' num2str(jx)], 'numbertitle', 'off');
                    figure(2);
                    patchMontage([image_root, sprintf('%08d',data(ix,jx).cam_id), '/', data(ix,jx).filename],...
                        data(ix,jx).bg_rects);
                    set(gcf, 'name', ['Non-People, camera:' num2str(data(ix,jx).cam_id) ', img_index:' num2str(jx)], 'numbertitle', 'off');
                    wait();
            end
        end
    end
end

end


function wait()
    key = input('Click enter to continue to next image:', 's');
    if ~isempty(key)
        wait();
    end
end